///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////

#include "ImageEditor.h"

// Using the construction of a static object to ensure that the help provider is set
class wxFBContextSensitiveHelpSetter
{
public:
wxFBContextSensitiveHelpSetter()
{
wxHelpProvider::Set( new wxSimpleHelpProvider );
}
};

static wxFBContextSensitiveHelpSetter s_wxFBSetTheHelpProvider;
///////////////////////////////////////////////////////////////////////////

MainWindow::MainWindow( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxFrame( parent, id, title, pos, size, style )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	
	wxBoxSizer* bSizer1;
	bSizer1 = new wxBoxSizer( wxVERTICAL );
	
	main_panel_ = new wxPanel( this, MAIN_PANEL, wxDefaultPosition, wxDefaultSize, wxNO_BORDER|wxTAB_TRAVERSAL );
	bSizer1->Add( main_panel_, 1, wxEXPAND|wxALL, 0 );
	
	this->SetSizer( bSizer1 );
	this->Layout();
	menu_ = new wxMenuBar( 0 );
	file_ = new wxMenu();
	wxMenuItem* open_;
	open_ = new wxMenuItem( file_, OPEN, wxString( _("Open...") ) + wxT('\t') + wxT("Ctrl+O"), wxEmptyString, wxITEM_NORMAL );
	file_->Append( open_ );
	
	wxMenuItem* save_;
	save_ = new wxMenuItem( file_, SAVE, wxString( _("Save") ) + wxT('\t') + wxT("Ctrl+S"), wxEmptyString, wxITEM_NORMAL );
	file_->Append( save_ );
	
	wxMenuItem* save_as_;
	save_as_ = new wxMenuItem( file_, wxID_ANY, wxString( _("Save As...") ) + wxT('\t') + wxT("Ctrl-Shift+S"), wxEmptyString, wxITEM_NORMAL );
	file_->Append( save_as_ );
	
	file_->AppendSeparator();
	
	wxMenuItem* close_menu_;
	close_menu_ = new wxMenuItem( file_, EXIT, wxString( _("Exit") ) + wxT('\t') + wxT("Alt-F4"), wxEmptyString, wxITEM_NORMAL );
	file_->Append( close_menu_ );
	
	menu_->Append( file_, _("File") );
	
	layer_ = new wxMenu();
	wxMenuItem* above_layer_;
	above_layer_ = new wxMenuItem( layer_, ABOVE, wxString( _("Switch to Layer Above") ) , wxEmptyString, wxITEM_NORMAL );
	layer_->Append( above_layer_ );
	
	wxMenuItem* below_layer_;
	below_layer_ = new wxMenuItem( layer_, BELOW, wxString( _("Switch to Layer Below") ) , wxEmptyString, wxITEM_NORMAL );
	layer_->Append( below_layer_ );

	layer_->AppendSeparator();
	
	wxMenuItem* move_;
	move_ = new wxMenuItem( layer_, MOVE, wxString( _("Move Image") ) , wxEmptyString, wxITEM_NORMAL );
	layer_->Append( move_ );

	menu_->Append( layer_, _("Layer") );
	
	object_ = new wxMenu();
	wxMenuItem* undo_;
	undo_ = new wxMenuItem( object_, wxID_ANY, wxString( _("Undo") ) + wxT('\t') + wxT("Ctrl+Z"), wxEmptyString, wxITEM_NORMAL );
	object_->Append( undo_ );
	
	wxMenuItem* redo_;
	redo_ = new wxMenuItem( object_, wxID_ANY, wxString( _("Redo") ) + wxT('\t') + wxT("Ctrl+Y"), wxEmptyString, wxITEM_NORMAL );
	object_->Append( redo_ );
	
	object_->AppendSeparator();
	
	wxMenuItem* rotate_left_;
	rotate_left_ = new wxMenuItem( object_, LROTATE, wxString( _("Rotate Left") ) , wxEmptyString, wxITEM_NORMAL );
	object_->Append( rotate_left_ );
	
	wxMenuItem* rotate_right_;
	rotate_right_ = new wxMenuItem( object_, RROTATE, wxString( _("Rotate Right") ) , wxEmptyString, wxITEM_NORMAL );
	object_->Append( rotate_right_ );
	
	object_->AppendSeparator();
	
	wxMenuItem* flip_up_down_;
	flip_up_down_ = new wxMenuItem( object_, FLIPUD, wxString( _("Flip Up Down") ) , wxEmptyString, wxITEM_NORMAL );
	object_->Append( flip_up_down_ );
	
	wxMenuItem* flip_left_right_;
	flip_left_right_ = new wxMenuItem( object_, FLIPLR, wxString( _("Flip Left Right") ) , wxEmptyString, wxITEM_NORMAL );
	object_->Append( flip_left_right_ );
	
	object_->AppendSeparator();
	
	wxMenuItem* crop_;
	crop_ = new wxMenuItem( object_, CROP, wxString( _("Crop") ) , wxEmptyString, wxITEM_NORMAL );
	object_->Append( crop_ );

	object_->AppendSeparator();
	
	wxMenuItem* subsamled_;
	subsamled_ = new wxMenuItem( object_, SUBSMPL, wxString( _("Subsample Image") ) , wxEmptyString, wxITEM_NORMAL );
	object_->Append( subsamled_ );
	
	menu_->Append( object_, _("Object") );
	
	this->SetMenuBar( menu_ );
	
	this->Centre( wxBOTH );
	
	// Connect Events
	this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainWindow::close ) );
	main_panel_->Connect( wxEVT_SIZE, wxSizeEventHandler( MainWindow::resize ), NULL, this );
	main_panel_->Connect( wxEVT_PAINT, wxPaintEventHandler( MainWindow::paint ), NULL, this );
	this->Connect( open_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::open ) );
	this->Connect( save_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::save ) );
	this->Connect( save_as_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::save_as ) );
	this->Connect( close_menu_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::quit ) );
	this->Connect( above_layer_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::above_layer ) );
	this->Connect( below_layer_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::below_layer ) );
	this->Connect( move_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::move ) );
	this->Connect( undo_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::undo ) );
	this->Connect( redo_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::redo ) );
	this->Connect( rotate_left_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::rotate_left ) );
	this->Connect( rotate_right_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::rotate_right ) );
	this->Connect( flip_up_down_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::flip_up_down ) );
	this->Connect( flip_left_right_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::flip_left_right ) );
	this->Connect( crop_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::crop ) );
	this->Connect( subsamled_->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::subsampled ) );
}

MainWindow::~MainWindow()
{
	// Disconnect Events
	this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( MainWindow::close ) );
	main_panel_->Disconnect( wxEVT_SIZE, wxSizeEventHandler( MainWindow::resize ), NULL, this );
	main_panel_->Disconnect( wxEVT_PAINT, wxPaintEventHandler( MainWindow::paint ), NULL, this );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::open ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::save ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::save_as ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::quit ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::above_layer ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::below_layer ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::move ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::undo ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::redo ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::rotate_left ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::rotate_right ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::flip_up_down ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::flip_left_right ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::crop ) );
	this->Disconnect( wxID_ANY, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainWindow::subsampled ) );
}

CropWindow::CropWindow( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( parent, id, title, pos, size, style, name )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetPosition( parent->GetScreenPosition() );
	
	wxStaticBoxSizer* crop_sizer;
	crop_sizer = new wxStaticBoxSizer( new wxStaticBox( this, CROP_SIZER, _("Set left-up corner and size of new image") ), wxVERTICAL );
	
	wxFlexGridSizer* fgSizer7;
	fgSizer7 = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizer7->SetFlexibleDirection( wxBOTH );
	fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	staticText2 = new wxStaticText( this, wxID_ANY, _("X"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText2->Wrap( -1 );
	fgSizer7->Add( staticText2, 0, wxALIGN_RIGHT|wxALL, 5 );

	x_ = new wxSpinCtrl( this, ID_X, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
	fgSizer7->Add( x_, 0, wxALL, 5 );
	
	staticText3 = new wxStaticText( this, wxID_ANY, _("Y"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText3->Wrap( -1 );
	fgSizer7->Add( staticText3, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	y_ = new wxSpinCtrl( this, ID_Y, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
	fgSizer7->Add( y_, 0, wxALL, 5 );
	
	staticText4 = new wxStaticText( this, wxID_ANY, _("Width"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText4->Wrap( -1 );
	fgSizer7->Add( staticText4, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	width_ = new wxSpinCtrl( this, ID_WIDTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS ); 
	fgSizer7->Add( width_, 0, wxALL, 5 );
	
	staticText5 = new wxStaticText( this, wxID_ANY, _("Height"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText5->Wrap( -1 );
	fgSizer7->Add( staticText5, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	height_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
	fgSizer7->Add( height_, 0, wxALL, 5 );
	
	apply_ = new wxButton( this, wxID_OK, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
	apply_->SetDefault();
	fgSizer7->Add( apply_, 0, wxALIGN_BOTTOM|wxALIGN_LEFT|wxALL, 5 );
	
	cancel_ = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer7->Add( cancel_, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 );
	
	crop_sizer->Add( fgSizer7, 1, wxEXPAND, 5 );
	
	this->SetSizer( crop_sizer );
	this->Layout();
	crop_sizer->Fit( this );
}

CropWindow::~CropWindow()
{
}

SubsmplWindow::SubsmplWindow( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( parent, id, title, pos, size, style, name )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetPosition( parent->GetScreenPosition() );
	
	wxStaticBoxSizer* sizer;
	sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Set subsampling factor") ), wxVERTICAL );
	
	wxFlexGridSizer* fgSizer7;
	fgSizer7 = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizer7->SetFlexibleDirection( wxBOTH );
	fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	staticText2 = new wxStaticText( this, wxID_ANY, _("Horizontal factor"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText2->Wrap( -1 );
	fgSizer7->Add( staticText2, 0, wxALIGN_RIGHT|wxALL, 5 );

	x_step_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 25, 1 );
	fgSizer7->Add( x_step_, 0, wxALL, 5 );
	
	staticText3 = new wxStaticText( this, wxID_ANY, _("Vertical factor"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText3->Wrap( -1 );
	fgSizer7->Add( staticText3, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	y_step_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 25, 1 );
	fgSizer7->Add( y_step_, 0, wxALL, 5 );
	
	apply_ = new wxButton( this, wxID_OK, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
	apply_->SetDefault();
	fgSizer7->Add( apply_, 0, wxALIGN_BOTTOM|wxALIGN_LEFT|wxALL, 5 );
	
	cancel_ = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer7->Add( cancel_, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 );
	
	sizer->Add( fgSizer7, 1, wxEXPAND, 5 );
	
	this->SetSizer( sizer );
	this->Layout();
	sizer->Fit( this );
}

SubsmplWindow::~SubsmplWindow()
{
}

MoveWindow::MoveWindow( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : wxDialog( parent, id, title, pos, size, style, name )
{
	this->SetSizeHints( wxDefaultSize, wxDefaultSize );
	this->SetPosition( parent->GetScreenPosition() );
	
	wxStaticBoxSizer* sizer;
	sizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Move image") ), wxVERTICAL );
	
	wxFlexGridSizer* fgSizer7;
	fgSizer7 = new wxFlexGridSizer( 2, 2, 0, 0 );
	fgSizer7->SetFlexibleDirection( wxBOTH );
	fgSizer7->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
	
	staticText2 = new wxStaticText( this, wxID_ANY, _("x offset"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText2->Wrap( -1 );
	fgSizer7->Add( staticText2, 0, wxALIGN_RIGHT|wxALL, 5 );

	x_offset_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
	fgSizer7->Add( x_offset_, 0, wxALL, 5 );
	
	staticText3 = new wxStaticText( this, wxID_ANY, _("y offset"), wxDefaultPosition, wxDefaultSize, 0 );
	staticText3->Wrap( -1 );
	fgSizer7->Add( staticText3, 0, wxALIGN_RIGHT|wxALL, 5 );
	
	y_offset_ = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS );
	fgSizer7->Add( y_offset_, 0, wxALL, 5 );
	
	apply_ = new wxButton( this, wxID_OK, _("Apply"), wxDefaultPosition, wxDefaultSize, 0 );
	apply_->SetDefault();
	fgSizer7->Add( apply_, 0, wxALIGN_BOTTOM|wxALIGN_LEFT|wxALL, 5 );
	
	cancel_ = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
	fgSizer7->Add( cancel_, 0, wxALIGN_BOTTOM|wxALIGN_RIGHT|wxALL, 5 );
	
	sizer->Add( fgSizer7, 1, wxEXPAND, 5 );
	
	this->SetSizer( sizer );
	this->Layout();
	sizer->Fit( this );
}

MoveWindow::~MoveWindow()
{
}
